package com.mall.admin.controller;

import com.mall.admin.service.OssService;
import com.mall.commons.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;


@RestController
@RequestMapping("/aliyun/oss")
public class OssController {

    @Autowired
    private OssService ossService;

    /**
     * 图片上传
     * 访问路径:/aliyun/oss/upload
     * @return
     */
    @PostMapping("/upload")
    public R savePic(MultipartFile photoFile) throws IOException {
        return ossService.savePic(photoFile);
    }

}
